package com.dormitory123.millet.service.Impl;

import com.dormitory123.millet.dao.Impl.UserDaoImpl;
import com.dormitory123.millet.dao.UserDao;
import com.dormitory123.millet.pojo.User;
import com.dormitory123.millet.service.UserService;

/**
 * @author yanhuanzhan
 * @date 2021/12/26 - 19:47
 */
public class UserServiceImpl implements UserService {
    UserDao userDao = new UserDaoImpl();
    @Override
    public void regist(User user) {
        userDao.saveUser(user);

    }

    @Override
    public User login(String username,String password) {
      return   userDao.queryUserByUserNameAndPassword(username,password);
    }

    @Override
    public boolean existUsername(String username) {
        if (userDao.queryUserByUserName(username) != null) {
            return true;
        }else {
            return false;
        }
    }
}
